<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>欢迎页</title>
    <link rel="stylesheet" type="text/css" href="../css/style.css"/>
    <script type="text/javascript" src="../js/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="../laydate/laydate.js"></script>
    <script src="../js/city-picker.data.js"></script>
    <script src="../js/city-picker.js"></script>
    <script src="../js/publicJS.js"></script>
    <style>
        .city-picker-span {
            width: 300px;
        }

        /*#div{*/
        /*text-align: center;*/
        /*}*/
    </style>
</head>

<body style="background:#328f46">
<div class="headiv">
    <div class="logotag">
        <a class="logo"><img src="../img/logo.png" width="440" height="65"></a>
        <b class="line"></b>
    </div>
    <a class="username">欢迎登录：<i id="name"></i></a>
    <span class="btnbox">
    	<a class="update" href="/updatePerson" title="修改"></a><a class="exit" href="/logout" title="退出"></a>
    </span>
    <div class="clear" style="height:20px; background:#328f46"></div>
</div>

<div class="messagebox">
    <div class="messageleft">
        <ul class="Fstage">
            <shiro:hasRole name="normalUser">
                <li><a href="#"><em class="e3"></em>健康信息管理
                    <div class="clear"></div>
                </a>
                    <ul class="Tstage">
                        <li><a href="/healthInfoAdd">健康信息录入</a></li>
                        <li><a href="/healthInfoSelect">健康指数查询</a></li>
                    </ul>
                </li>
                <li><a href="#"><em class="e3"></em>运动信息管理
                    <div class="clear"></div>
                </a>
                    <ul class="Tstage">
                        <li><a href="/sportIndex">运动信息录入</a></li>
                        <li><a href="/sportIndexSelect">运动信息查询</a></li>
                    </ul>
                </li>
                <li><a href="#"><em class="e3"></em>心理测试
                    <div class="clear"></div>
                </a>
                    <ul class="Tstage">
                        <li><a href="/testPage">开始测试</a></li>
                        <li><a href="/testrecord">测试记录</a></li>
                    </ul>
                </li>
                <li><a href="#"><em class="e3"></em>健康新闻
                    <div class="clear"></div>
                </a>
                    <ul class="Tstage">
                        <li><a href="/healthnewsPage">健康新闻</a></li>
                    </ul>
                </li>
            </shiro:hasRole>

            <shiro:hasRole name="admin">
                <li><a href="#"><em class="e3"></em>用户管理
                    <div class="clear"></div>
                </a>
                    <ul class="Tstage">
                        <li><a href="/userManagement">用户管理</a></li>
                        <li><a href="/userManageSelect">查询所有用户</a></li>
                    </ul>
                </li>
                <li><a href="#"><em class="e3"></em>发布新闻
                    <div class="clear"></div>
                </a>
                    <ul class="Tstage">
                        <li><a href="/releaseNewsPage">发布新闻</a></li>
                    </ul>
                </li>
            </shiro:hasRole>
        </ul>
    </div>
    <!--****************以上不能动，页面固定的东西************************-->

    <div id="div" class="messageright formpage">
        <h2>运动信息录入</h2>
        <br>
        <br>
        录入时间:<input type="text" id="time">
        <br>
        <br>
        跑 步:<input type="text" id="run" class="textput"><br><br>
        跳 绳:<input type="text" id="rope" class="textput"><br><br>
        快 走:<input type="text" id="foot" class="textput"><br><br>
        仰卧起坐:<input type="text" id="situp" class="textput"><br><br>
        做俯卧撑:<input type="text" id="pushup" class="textput"><br><br>
        平板支撑:<input type="text" id="plank" class="textput"><br><br>
        <input type="button" value="保存" id="save" class="greenbtn">
    </div>
</div>
</body>
<script src="../js/jquery-3.2.1.js"></script>
<script>
    laydate.render({
        elem: '#time',
        type: 'date'
    });
    $("#save").click(function () {
        $.ajax({
            url: "/insert",
            type: "post",
            data: {
                run: $("#run").val(),
                rope: $("#rope").val(),
                foot: $("#foot").val(),
                situp: $("#situp").val(),
                pushup: $("#pushup").val(),
                plank: $("#plank").val(),
                date: $("#time").val()
            },
            success: function (result) {
                if (result) {
                    alert("保存成功")
                    window.location.href = "/home";
                } else {
                    alert("保存失败")
                }
            }
        });
    });

    $("#re").click(function () {
        window.location.href = "/re";
    });
</script>
</html>
